<?php
include 'Serializer.php';

class KonwerterXML implements Konwerter{
	public function konwertujDane(array $dane)
	{
		//ustawiamy opcje xml
		$opcje = array( 	"addDecl" => true,
				"defaultTagName" => get_class($dane[0]), 
				"indent" => " ", 
				"rootName" => "root");

		//tworzymy obiekt serializacji
		$serializer = new XML_Serializer($opcje);
		$result = $serializer->serialize($dane);
		echo $serializer->getSerializedData();

		/*$filename = 'plik.xml';
		// open file
		if (!$handle = fopen($filename, 'w'))
		{
			print "Cannot open file ($filename)";
			exit;
		}

		// write XML to file
		if (!fwrite($handle, $serializer->getSerializedData()))
		{
			print "Cannot write to file ($filename)";
			exit;
		}

		// close file
		fclose($handle);*/
	}
}
?>